<?php

use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

// 需要验证token的
Route::middleware('token')->group(function () {
    
    // 用户相关的
    Route::prefix('users')->group(function () {
        Route::get('list', 'UsersController@list');  // 用户的个人信息
    });

    // 我的xx
    Route::prefix('my')->group(function () {
        Route::get('collect', 'MyController@collect'); // 我的收藏
        Route::get('shoppingCart', 'MyController@collect'); // 我的购物车
    });

});

// 不需要验证token的
Route::prefix('auth')->group(function () {
    Route::get('login', 'AuthController@login'); //登录
    Route::get('register', 'AuthController@register'); //注册
    Route::get('logout', 'AuthController@logout'); // 退出登录
    Route::get('Cart', 'MyController@Cart'); // 购物车 不登录

});

// 商品相关的
Route::prefix('goods')->group(function () {
    Route::get('list', 'GoodsController@list'); //全部的商品列表
});

// 商品分类
Route::prefix('cates')->group(function () {
    Route::get('list', 'CatesController@list'); // 分类列表
});

